#ifndef MOTIONSTATE_H
#define MOTIONSTATE_H

#include <cmexport.h>
#include <btBulletDynamicsCommon.h>
#include <scene/entitynode.h>

/**
 * \addtogroup physics
 * @{
 */

/**
 * @brief Implementation of the btMotionState interface for handling ceEntityNode
 */
class CM_API cmEntityMotionState : public btMotionState
{
private:
  ceEntityNode            *_entity;
  btRigidBody             *_body;

public:

  cmEntityMotionState(ceEntityNode* entity = 0, btRigidBody* body = 0);

  void SetEntity (ceEntityNode* entity);
  ceEntityNode* GetEntity ();
  const ceEntityNode* GetEntity () const;

  void SetRigidBody (btRigidBody* body);
  btRigidBody* GetRigidBody ();
  const btRigidBody* GetRigidBody () const;


  /**
   * \name Implementation of the Bullet btMotionState interface
   * @{
   */
  void getWorldTransform(btTransform &worldTrans) const;
  void setWorldTransform(const btTransform &worldTrans);
  /**
   * @}
   */
};

/** @} */

#endif // MOTIONSTATE_H
